package com.yeu.action;

import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.struts2.interceptor.SessionAware;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import com.yeu.util.ConnectionPool;
import com.yeu.util.ExcelUtil;
import com.yeu.model.Event2;


public class Event2Action extends ActionSupport implements ModelDriven<Event2>,
		SessionAware {
	private static final long serialVersionUID = 1L;
	private Event2 event2 = new Event2();
	private Map<String, Object> session;
	private Map<String, Boolean> boolResult;
	private Map<String, Object> mapResult;
	private List<Map<String, String>> result;
	private int rows;
	private int page;
	private String sort;
	private String order;
	private String eventIdForUniqueQuery;
	
	public String getEventIdForUniqueQuery() {
		return eventIdForUniqueQuery;
	}

	public void setEventIdForUniqueQuery(String eventIdForUniqueQuery) {
		this.eventIdForUniqueQuery = eventIdForUniqueQuery;
	}

	public List<Map<String, String>> getResult() {
		return result;
	}

	public void setEvent(Event2 event2) {
		this.event2 = event2;
	}

	public Map<String, Boolean> getBoolResult() {
		return boolResult;
	}

	public Map<String, Object> getMapResult() {
		return mapResult;
	}

	public void setRows(int rows) {
		this.rows = rows;
	}

	public void setPage(int page) {
		this.page = page;
	}

	public void setSort(String sort) {
		this.sort = sort;
	}

	public void setOrder(String order) {
		this.order = order;
	}

	@Override
	public Event2 getModel() {
		return this.event2;
	}

	@Override
	public void setSession(Map<String, Object> session) {
		this.session = session;
	}
    
	
	public String add() {
		event2.setEventStatus("未完成");
		// System.out.println(event2.getInformCooperate());
		String sql = "insert into EVENT2(EVENTID,RELATION,REPORTERNAME,EVENTDATE,EVENTSTATUS,REPORTERORGANIZATION,REPORTERPHONE,"
				+ "REPORTERADDRESS,VICTIMETYPE,GRADE,STUD_ACADEMY,STUD_MAJOR,CLASSNAME,GENDER,STUD_NAME,STUD_ID,STU_ROOM,"
				+ "CONTACTPHONE,CLASSMONITOR,CLASSDIRECTOR,DIRECTORPHONENUMBER,TEAC_ACADEMY,REPORTERTEACHERNAME,REPORTTEACHERPHONE,"
				+ "TEAC_BUILDING,TEAC_ROOM,DEPARTMENTLEADER,LEADERPHONENUMBER,EVENTTYPE,ADMINDEPARTMENT,ADMINDEPARTMENTLEADER,"
				+ "ADMINDEPARTMENTLEADERPHONE,COOPERATEDEPARTMENT,COOPERATEDEPARTMENTLEADER,COOPERATEDEPARTMENTLEADERPHONE,"
				+ "EXECUTOR,EXECUTORPHONE,SMSINFORM,PHONEINFORM,INFORMEXECUTOR,INFORMADMINDEPARTMENTLEADER,INFORMCLASSDIRECTOR,"
				+ "INFORMOTHERS,EVENTCONTENT,INFORMCOOPERATE)"
				+ "values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,"
				+ "?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
		if (ConnectionPool.executeQuery(
				"select EVENTID from EVENT2 where EVENTID=?",
				event2.getEventId()).size() != 0) {
			boolResult = new HashMap<String, Boolean>();
			boolResult.put("RESULT", false);
		} else {
			boolResult = ConnectionPool.executeUpdate(sql, event2.getEventId(),
					event2.getRelation(), event2.getReporterName(),
					event2.getEventDate(), event2.getEventStatus(),
					event2.getReporterOrganization(),
					event2.getReporterPhone(), event2.getReporterAddress(),
					event2.getVictimeType(), event2.getGrade(),
					event2.getStud_academy(), event2.getStud_major(),
					event2.getClassName(), event2.getGender(),
					event2.getStud_name(), event2.getStud_id(),
					event2.getStu_room(), event2.getContactPhone(),
					event2.getClassMonitor(), event2.getClassDirector(),
					event2.getDirectorPhoneNumber(), event2.getTeac_academy(),
					event2.getReporterTeacherName(),
					event2.getReportTeacherPhone(), event2.getTeac_building(),
					event2.getTeac_room(), event2.getDepartmentLeader(),
					event2.getLeaderPhoneNumber(), event2.getEventType(),
					event2.getAdminDepartment(),
					event2.getAdminDepartmentLeader(),
					event2.getAdminDepartmentLeaderPhone(),
					event2.getCooperateDepartment(),
					event2.getCooperateDepartmentLeader(),
					event2.getCooperateDepartmentLeaderPhone(),
					event2.getExecutor(), event2.getExecutorPhone(),
					event2.getSmsInform(), event2.getPhoneInform(),
					event2.getInformExecutor(),
					event2.getInformAdminDepartmentLeader(),
					event2.getInformClassDirector(), event2.getInformOthers(),
					event2.getEventContent(), event2.getInformCooperate());
		}
		return "boolResult";
	}

	public String status() {
		mapResult = new HashMap<String, Object>();
		String sqlQuery = "select EVENTSTATUS from EVENT2 where EVENTID = ?";
		result = ConnectionPool.executeQuery(sqlQuery, event2.getEventId());
		if (result.size() != 0) {
			String sql = "update EVENT2 set EVENTSTATUS=? where EVENTID=?";
			boolResult = ConnectionPool.executeUpdate(sql,
					event2.getEventStatus(), event2.getEventId());
			mapResult.put("RESULT", boolResult.get("RESULT").toString());
			mapResult.put("oldValue", result.get(0).get("EVENTSTATUS"));
		} else {
			mapResult.put("RESULT", false);
		}
		return "mapResult";
	}

	public String updateAdminDepartment() {
		// System.out.println("eventid="+event2.getEventId()+",adminDepartment="+event2.getAdminDepartment());
		String sqlQuery = "select ADMINDEPARTMENT from EVENT2 where EVENTID = ?";
		result = ConnectionPool.executeQuery(sqlQuery, event2.getEventId());
		mapResult = new HashMap<String, Object>();
		// String adminLeader =
		// String sql = "update EVENT2 set ADMINDEPARTMENT=? where EVENTID=?";
		// boolResult = ConnectionPool.executeUpdate(sql,
		// event2.getAdminDepartment(),event2.getEventId());
		String updateNameAndPhoneSql = "select username,phone from usertable,department,departmentleader where usertable.userid = departmentleader.userid and department.departmentid = departmentleader.departmentid and usertable.userid like '%001' and department.departmentname = ?";
		List<Map<String, String>> nameAndPhoneResult = ConnectionPool
				.executeQuery(updateNameAndPhoneSql,
						event2.getAdminDepartment());
		// System.out.println("nameAndPhoneResult=" + nameAndPhoneResult);
		if (nameAndPhoneResult.size() != 0 && result.size() != 0) {
			String username = nameAndPhoneResult.get(0).get("USERNAME");
			String phone = nameAndPhoneResult.get(0).get("PHONE");
			// System.out.println("username="+username+",phone="+phone);
			String updateSql = "update EVENT2 set ADMINDEPARTMENT = ?,ADMINDEPARTMENTLEADER=?,ADMINDEPARTMENTLEADERPHONE=? where EVENTID = ?";
			boolResult = ConnectionPool.executeUpdate(updateSql,
					event2.getAdminDepartment(), username, phone,
					event2.getEventId());
			mapResult.put("RESULT", boolResult.get("RESULT").toString());
			mapResult.put("oldValue", result.get(0).get("ADMINDEPARTMENT"));
			// 同步更新主管领导姓名和电话
			mapResult.put("USERNAME", username);
			mapResult.put("PHONE", phone);
		} else {
			mapResult.put("RESULT", "false");
		}

		return "mapResult";
	}

	public String updateEventType() {
		String sqlQuery = "select EVENTTYPE from EVENT2 where EVENTID = ?";
		mapResult = new HashMap<String, Object>();
		result = ConnectionPool.executeQuery(sqlQuery, event2.getEventId());
		if (result.size() != 0) {
			String sql = "update EVENT2 set EVENTTYPE = ? where EVENTID = ?";
			boolResult = ConnectionPool.executeUpdate(sql,
					event2.getEventType(), event2.getEventId());
			mapResult.put("RESULT", boolResult.get("RESULT").toString());
			mapResult.put("oldValue", result.get(0).get("EVENTTYPE"));
		} else {
			mapResult.put("RESULT", "false");
		}
		return "mapResult";
	}

	/*
	 * public String eventId(){ String eventId=(String) session.get("eventId");
	 * String sql=
	 * "select * from EVENT,DEPARTMENTLEADER,USERTABLE,CLASS where EVENTID=? and EVENT.EVENTADMINBY=DEPARTMENTLEADER.DEPARTMENTID and DEPARTMENTLEADER.USERID=USERTABLE.USERID and EVENT.REPORTERCLASS=CLASS.CLASSID"
	 * ; result=ConnectionPool.executeQuery(sql, eventId); for (Map<String,
	 * String> map : result) { map.remove("ROLEID"); map.remove("PASSWORD");
	 * map.remove("USERID"); map.remove("CLASSDIRECTORNAME");
	 * map.remove("CLASSMONITORNAME"); } return SUCCESS; }
	 */

	public String userId() {
		mapResult = new HashMap<String, Object>();
		String userId = (String) session.get("userId");
		String sqlA = String
				.format("SELECT * FROM (SELECT A.*,ROWNUM RN FROM (select event2.* from event2,department,departmentleader where department.departmentname = event2.admindepartment and department.departmentid = departmentleader.departmentid and departmentleader.userid=? ORDER BY %s %s) A WHERE ROWNUM<=%d) WHERE RN>%d",
						sort, order, rows * page, rows * (page - 1));

		// String
		// sqlB=String.format("select t.*,rownum from event2 t where rownum <= %d and rownum >%d ",rows*page,rows*(page-1));
		String sqlB = String
				.format("SELECT * FROM (SELECT A.*,ROWNUM RN FROM (select event2.* from event2,department,departmentleader where department.departmentname = event2.admindepartment and department.departmentid = departmentleader.departmentid ORDER BY %s %s) A WHERE ROWNUM<=%d) WHERE RN>%d",
						sort, order, rows * page, rows * (page - 1));

		
		if (userId.equals("bw0001")) {
			result = ConnectionPool.executeQuery(sqlB);
			String total = ConnectionPool
					.executeQuery("select COUNT(*) from event2").get(0)
					.get("COUNT(*)");
			mapResult.put("total", total);
			mapResult.put("rows", result);

			return "mapResult";
		} else {
			// System.out.println("sort="+sort+",order="+order+","+"rows="+rows+",page="+page);
			/*
			 * for (Map<String, String> map : result) { map.remove("ROLEID");
			 * map.remove("REPORTERDEPARTMENT");
			 * map.remove("CLASSDEPARTMENTID"); map.remove("DEPARTMENTID");
			 * map.remove("REPORTERCLASS"); map.remove("EVENTADMINBY");
			 * map.remove("USERID"); map.remove("RN"); map.remove("CLASSID"); }
			 */
			// System.out.println("records =" + result.size());
			// sql="SELECT COUNT(*) FROM EVENT WHERE EVENTADMINBY=?";
			// String
			// total=ConnectionPool.executeQuery(sql,userId).get(0).get("COUNT(*)");

			String sqlA1 = String
					.format("select COUNT(*) from event2,department,departmentleader where department.departmentname = event2.admindepartment and department.departmentid = departmentleader.departmentid and departmentleader.userid=? ORDER BY %s %s",
							sort, order);
			result = ConnectionPool.executeQuery(sqlA, userId);
			// System.out.println(sqlA1);
			List<Map<String, String>> totalList = ConnectionPool.executeQuery(
					sqlA1, userId);
			// System.out.println(totalList);
			String total = totalList.get(0).get("COUNT(*)");
			mapResult.put("total", total);
			mapResult.put("rows", result);
			return "mapResult";
		}
	}

	public String search() {
		// 高级搜索 
		mapResult = new HashMap<String, Object>();
		String userId = (String) session.get("userId");
		String sqlA = "";
		String sqlB = "";  
	
		if (userId.equals("bw0001")) {
			sqlB = String
					.format("SELECT * FROM (SELECT A.*,ROWNUM RN FROM (select event2.* from event2,department,departmentleader where department.departmentname = event2.admindepartment and department.departmentid = departmentleader.departmentid AND (EVENTDATE LIKE ! OR REPORTERNAME LIKE ! OR CONTACTPHONE LIKE ! OR EVENTSTATUS LIKE ! OR EVENTCONTENT LIKE ! OR RELATION LIKE ! OR VICTIMETYPE LIKE ! OR EVENTTYPE LIKE ! OR STUD_ID LIKE ! OR STUD_NAME LIKE ! OR REPORTERTEACHERNAME LIKE ! OR EVENTID LIKE ! OR TEAC_ACADEMY LIKE !) ORDER BY %s %s) A WHERE ROWNUM<=%d) WHERE RN>%d",
							sort, order, rows * page, rows * (page - 1));
			sqlB = sqlB.replaceAll("[!]", "'%" + event2.getKeyWord() + "%'");
			result = ConnectionPool.executeQuery(sqlB);
			for (Map<String, String> map : result) {
				map.remove("ROLEID");
				map.remove("REPORTERDEPARTMENT");
				map.remove("CLASSDEPARTMENTID");
				map.remove("DEPARTMENTID");
				map.remove("REPORTERCLASS");
				map.remove("EVENTADMINBY");
				map.remove("USERID");
				map.remove("RN");
				map.remove("CLASSID");
			}
			sqlB="SELECT COUNT(*) FROM EVENT2,DEPARTMENT,DEPARTMENTLEADER WHERE DEPARTMENT.DEPARTMENTNAME = EVENT2.ADMINDEPARTMENT AND DEPARTMENT.DEPARTMENTID = DEPARTMENTLEADER.DEPARTMENTID AND (EVENTDATE LIKE ! OR REPORTERNAME LIKE ! OR CONTACTPHONE LIKE ! OR EVENTSTATUS LIKE ! OR EVENTCONTENT LIKE ! OR RELATION LIKE ! OR VICTIMETYPE LIKE ! OR EVENTTYPE LIKE ! OR STUD_ID LIKE ! OR STUD_NAME LIKE ! OR REPORTERTEACHERNAME LIKE ! OR EVENTID LIKE ! OR TEAC_ACADEMY LIKE !)";
			sqlB = sqlB.replaceAll("[!]", "'%" + event2.getKeyWord() + "%'");
		       
			String total = ConnectionPool.executeQuery(sqlB).get(0)
					.get("COUNT(*)");
			mapResult.put("total", total);
			mapResult.put("rows", result);

			return "mapResult";
		} else {
			
			sqlA = String.format("SELECT * FROM (SELECT A.*,ROWNUM RN FROM (SELECT EVENT2.* FROM EVENT2,DEPARTMENT,DEPARTMENTLEADER WHERE DEPARTMENT.DEPARTMENTNAME = EVENT2.ADMINDEPARTMENT AND DEPARTMENT.DEPARTMENTID = DEPARTMENTLEADER.DEPARTMENTID AND DEPARTMENTLEADER.USERID=? AND (EVENTDATE LIKE ! OR REPORTERNAME LIKE ! OR CONTACTPHONE LIKE ! OR EVENTSTATUS LIKE ! OR EVENTCONTENT LIKE ! OR RELATION LIKE ! OR VICTIMETYPE LIKE ! OR EVENTTYPE LIKE ! OR STUD_ID LIKE ! OR STUD_NAME LIKE ! OR REPORTERTEACHERNAME LIKE ! OR EVENTID LIKE ! OR TEAC_ACADEMY LIKE !) ORDER BY %s %s) A WHERE ROWNUM<=%d) WHERE RN>%d",
							sort, order, rows * page, rows * (page - 1));
			sqlA = sqlA.replaceAll("[!]", "'%" + event2.getKeyWord() + "%'");
			//刷 检索出 数据
		
		result = ConnectionPool.executeQuery(sqlA, userId);
		for (Map<String, String> map : result) {
			map.remove("ROLEID");
			map.remove("REPORTERDEPARTMENT");
			map.remove("CLASSDEPARTMENTID");
			map.remove("DEPARTMENTID");
			map.remove("REPORTERCLASS");
			map.remove("EVENTADMINBY");
			map.remove("USERID");
			map.remove("RN");
			map.remove("CLASSID");
		}

		sqlA = "SELECT COUNT(*) FROM EVENT2,DEPARTMENT,DEPARTMENTLEADER WHERE DEPARTMENT.DEPARTMENTNAME = EVENT2.ADMINDEPARTMENT AND DEPARTMENT.DEPARTMENTID = DEPARTMENTLEADER.DEPARTMENTID AND DEPARTMENTLEADER.USERID=? AND (EVENTDATE LIKE ! OR REPORTERNAME LIKE ! OR CONTACTPHONE LIKE ! OR EVENTSTATUS LIKE ! OR EVENTCONTENT LIKE ! OR RELATION LIKE ! OR VICTIMETYPE LIKE ! OR EVENTTYPE LIKE ! OR STUD_ID LIKE ! OR STUD_NAME LIKE ! OR REPORTERTEACHERNAME LIKE ! OR EVENTID LIKE ! OR TEAC_ACADEMY LIKE !)";
		sqlA = sqlA.replaceAll("[!]", "'%" + event2.getKeyWord() + "%'");
        //计算 总行数
		
		String total = ConnectionPool.executeQuery(sqlA, userId).get(0)
				.get("COUNT(*)");

		mapResult.put("total", total);
		mapResult.put("rows", result);
		return "mapResult";
		}
	}

	public String print() {
		Map<String, String> map = new LinkedHashMap<String, String>();
		map.put("案件号", event2.getEventId());
		map.put("与当事人关系", event2.getRelation());
		map.put("报案人姓名", event2.getReporterName());
		map.put("报案日期", event2.getEventDate());
		map.put("案件状态", event2.getEventStatus());
		map.put("报案人单位", event2.getReporterOrganization());
		map.put("报案人电话", event2.getReporterPhone());
		map.put("报案人地址", event2.getReporterAddress());
		map.put("当事人类型", event2.getVictimeType());
		map.put("学生班级", event2.getClassName());
		map.put("学生院系", event2.getStud_academy());
		map.put("学生性别", event2.getGender());
		map.put("学生姓名", event2.getStud_name());
		map.put("学生学号", event2.getStud_id());
		map.put("学生宿舍", event2.getStu_room());
		map.put("联系电话", event2.getContactPhone());
		map.put("班主任", event2.getClassMonitor());
		map.put("辅导员", event2.getClassDirector());
		map.put("辅导员电话", event2.getDirectorPhoneNumber());
		map.put("工作单位", event2.getTeac_academy());
		map.put("教师姓名", event2.getReporterTeacherName());
		map.put("教师联系电话", event2.getReportTeacherPhone());
		map.put("教师宿舍楼", event2.getTeac_building());
		map.put("教师宿舍号", event2.getTeac_room());
		map.put("院系领导", event2.getDepartmentLeader());
		map.put("领导电话", event2.getLeaderPhoneNumber());
		map.put("案件类型", event2.getEventType());
		map.put("主管部门", event2.getAdminDepartment());
		map.put("主管部门领导", event2.getAdminDepartmentLeader());
		map.put("主管领导电话", event2.getAdminDepartmentLeaderPhone());
		map.put("协助部门", event2.getCooperateDepartment());
		map.put("协管领导", event2.getCooperateDepartmentLeader());
		map.put("协管领导电话", event2.getCooperateDepartmentLeaderPhone());
		map.put("具体经办人", event2.getExecutor());
		map.put("经办人电话", event2.getExecutorPhone());
		map.put("短信通知?", event2.getSmsInform());
		map.put("电话通知?", event2.getPhoneInform());
		map.put("通知具体经办人?", event2.getInformExecutor());
		map.put("通知主管领导?", event2.getInformAdminDepartmentLeader());
		map.put("通知辅导员?", event2.getInformClassDirector());
		map.put("通知协管领导?", event2.getInformCooperate());
		map.put("其它人员", event2.getInformOthers());
		map.put("案件类容", event2.getEventContent());

		event2.setFileStream(ExcelUtil.create(map));
		event2.setFileFileName(event2.getEventId() + ".xls");
		event2.setFileContentType("application/vnd.ms-excel");
		return INPUT;
	}

	private void setEventByEventId() {
		String sql = "select * from event2 where EVENTID = ?";
		result = ConnectionPool.executeQuery(sql, eventIdForUniqueQuery);
		Map<String, String> mapR = result.get(0);
		System.out.print(mapR);
		event2.setAdminDepartment(mapR.get("ADMINDEPARTMENT"));
		event2.setAdminDepartmentLeader(mapR.get("ADMINDEPARTMENTLEADER"));
		event2.setAdminDepartmentLeaderPhone(mapR.get("ADMINDEPARTMENTLEADERPHONE"));
		event2.setClassDirector(mapR.get("CLASSDIRECTOR"));
		event2.setClassMonitor(mapR.get("CLASSMONITOR"));
		event2.setClassName(mapR.get("CLASSNAME"));
		event2.setContactPhone(mapR.get("CONTACTPHONE"));
		event2.setCooperateDepartment(mapR.get("COOPERATEDEPARTMENT"));
		event2.setCooperateDepartmentLeader(mapR
				.get("COOPERATEDEPARTMENTLEADER"));
		event2.setCooperateDepartmentLeaderPhone(mapR
				.get("OOPERATEDEPARTMENTLEADERPHONE"));
		event2.setDepartmentLeader(mapR.get("DEPARTMENTLEADER"));
		event2.setDirectorPhoneNumber(mapR.get("DIRECTORPHONENUMBER"));
		event2.setEventContent(mapR.get("EVENTCONTENT"));
		event2.setEventDate(mapR.get("EVENTDATE"));
		event2.setEventId(mapR.get("EVENTID"));
		event2.setEventStatus(mapR.get("EVENTSTATUS"));
		event2.setEventType(mapR.get("EVENTTYPE"));
		event2.setExecutor(mapR.get("EXECUTOR"));
		event2.setExecutorPhone(mapR.get("EXECUTORPHONE"));
		event2.setGender(mapR.get("GENDER"));
		event2.setGrade(mapR.get("GRADE"));
		event2.setInformAdminDepartmentLeader(mapR.get("ADMINDEPARTMENTLEADER"));
		event2.setInformClassDirector(mapR.get("INFORMCALSSDIRECTOR"));
		event2.setInformCooperate(mapR.get("INFORMCOOPERATE"));
		event2.setInformExecutor(mapR.get("INFORMEXECUTOR"));
		event2.setInformOthers(mapR.get("INFORMOTHERS"));
		event2.setLeaderPhoneNumber(mapR.get("LEADERPHONENUMBER"));
		event2.setPhoneInform(mapR.get("PHONEINFORM"));
		event2.setRelation(mapR.get("RELATION"));
		event2.setReporterAddress(mapR.get("REPORTERADDRESS"));
		event2.setReporterName(mapR.get("REPORTERNAME"));
		event2.setReporterOrganization(mapR.get("REPORTERORGANIZATION"));
		event2.setReporterPhone(mapR.get("REPORTERPHONE"));
		event2.setReporterTeacherContactPhone(mapR.get("REPORTERTEACHERCONTACTPHONE"));
		event2.setReporterTeacherName(mapR.get("REPORTERTEACHERNAME"));
		event2.setReportTeacherPhone(mapR.get("REPORTERTEACHERPHONE"));
		event2.setSmsInform(mapR.get("SMSINFORM"));
		event2.setStu_room(mapR.get("STU_ROOM"));
		event2.setStud_academy(mapR.get("STUD_ACADEMY"));
		event2.setStud_id(mapR.get("STUD_ID"));
		event2.setStud_major(mapR.get("STUD_MAJOR"));
		event2.setStud_name(mapR.get("STUD_NAME"));
		event2.setTeac_academy(mapR.get("TEAC_ACADEMY"));
		event2.setTeac_building(mapR.get("TEAC_BUILDING"));
		event2.setTeac_room(mapR.get("TEAC_ROOM"));
		event2.setVictimeType(mapR.get("VICTIMETYPE"));
	}

	public String print2() {
		setEventByEventId();
		return print();
	}

	public String getEventInfo() {
		mapResult = new HashMap<String, Object>();
		String sql = "select * from event2 where EVENTID = ?";
		result = ConnectionPool.executeQuery(sql, eventIdForUniqueQuery);
		Map<String, String> mapR = result.get(0);
		Set<String> keySet = mapR.keySet();
		Iterator<String> it = keySet.iterator();
		while (it.hasNext()) {
			String key = it.next();
			String value = mapR.get(key);
			mapResult.put(key, (Object) value);
		}
		// System.out.println(mapResult);
		return "mapResult";
	}
}
